package com.hailiang.study.javase.java.math;

import org.junit.Test;

import java.math.BigDecimal;

public class BigDecimal_remainder {

    @Test
    public void test_remainder_01() {
        BigDecimal b1, b2, b3;
        b1 = new BigDecimal("99.8");
        b2 = new BigDecimal("3");

        b3 = b1.remainder(b2);
        System.out.println(b3); // 返回0.8  --> (33.0 * 3 + 0.8 = 99.8)


        b1 = new BigDecimal("110.8");
        b2 = new BigDecimal("3");
        b3 = b1.remainder(b2);
        System.out.println(b3); // 返回2.8  --> (36 * 3 + 2.8 = 110.8)
    }
}
